package com.ymt.reliable.message.exceptionretry.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
@ConfigurationProperties(prefix = "message.retry")
public class MessageRetryConfig {
    private Long timeout;
    private Integer maxsendtimes;
    private Map<Integer, Long> times;

    public Map<Integer, Long> getTimes() {
        return times;
    }

    public void setTimes(Map<Integer, Long> times) {
        this.times = times;
    }

    public Long getDelayTime(Integer count) {
        return times.get(count);
    }

    public Long getTimeout() {
        return timeout;
    }

    public void setTimeout(Long timeout) {
        this.timeout = timeout;
    }

    public Integer getMaxsendtimes() {
        return maxsendtimes;
    }

    public void setMaxsendtimes(Integer maxsendtimes) {
        this.maxsendtimes = maxsendtimes;
    }
}
